Skip to content

[codex] Share safe URL diagnostics#3403

Closed
juliusmarminge wants to merge 32 commits into
mainfrom
codex/redact-dpop-request-target
Closed

[codex] Share safe URL diagnostics#3403
juliusmarminge wants to merge 32 commits into
mainfrom
codex/redact-dpop-request-target

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

Error context often needs enough URL information to correlate failures without retaining secrets. Several clients had independently added local URL parsers, increasing the chance that credentials, paths, query parameters, fragments, or signed tokens would leak into logs and telemetry.

This shared foundation adds two deliberately separate helpers:

  • getUrlDiagnostics from the explicit @t3tools/shared/urlDiagnostics subpath returns only { inputLength, protocol?, hostname? }. Invalid input returns length only; it never exposes path, userinfo, query, or fragment data.
  • redactDpopRequestTarget remains in @t3tools/shared/dpop for the narrower DPoP use case, where scheme/host/port/path are part of the request-target diagnostics while credentials/query/fragment are removed.

Focused tests cover sensitive valid URLs and invalid input for both policies.

Validation

  • vp test run packages/shared/src/urlDiagnostics.test.ts packages/shared/src/dpop.test.ts (10 tests)
  • vp check (passes with 20 pre-existing warnings)
  • vp run typecheck

Note

Add safe URL diagnostics to errors across the stack to prevent secret leakage

  • Introduces getUrlDiagnostics and redactDpopRequestTarget utilities in @t3tools/shared that extract only safe URL fields (hostname, protocol, input length) without retaining credentials, query strings, or fragments.
  • Replaces generic Error throws and Data.TaggedError classes throughout server, web, mobile, desktop, and relay packages with structured Schema.TaggedErrorClass types that include operation context, safe URL diagnostics, and preserved causes.
  • Error messages across all affected modules are now standardized and non-leaky; sensitive URL data is omitted from message strings, logs, and tracing span attributes.
  • Adds ConnectionStorageOperationError, IndexedDbUnavailableError, DesktopSecureStorageUnavailableError, and ConnectionPersistenceError structured types in the client-runtime to unify storage failure reporting with operation, backend, and resource context.
  • Replaces SSH_PASSWORD_PROMPT_CANCELLED_RESULT with DesktopSshPasswordPromptCancellationError across desktop IPC, preload, and contract boundaries so SSH cancellations surface as typed structured errors.
  • Risk: Many error _tag values, message strings, and field shapes are changed across public contracts — callers that pattern-match on old tags, messages, or fields (e.g. detail vs message, KeybindingsConfigParseErrorKeybindingsConfigError) will need updates.

Macroscope summarized 761be94.


Note

Medium Risk
Broad changes to error _tag values, field shapes, and message/detail strings across IPC, preload, and mobile UI; consumers matching old tags or reading raw messages may break, though behavior is largely preserved with safer diagnostics.

Overview
Standardizes failure handling across desktop, mobile, server, and shared clients by replacing swallowed booleans, generic Error throws, and stringly IPC payloads with Effect Schema.TaggedErrorClass types that carry operation context and a cause, while user-facing **message getters avoid echoing secrets or nested causes.

Safe URL context comes from shared helpers (getUrlDiagnostics, redactDpopRequestTarget): errors and logs keep length / protocol / hostname (or redacted DPoP request targets) instead of full URLs, paths, query strings, or credentials. Desktop ElectronShell now fails openExternal / copyText with typed errors; window IPC still returns false for failed opens but logs redacted structured fields. SSH password prompt cancellation moves from a string type to DesktopSshPasswordPromptCancellationError with reason, request id, and destination.

Mobile connection catalog, migration, and file-backed shell/thread cache map storage failures through ConnectionStorageOperationError / ConnectionPersistenceError with stage and resource metadata. Cloud link/DPoP paths split the old monolithic link error into discriminated types (operation, mismatch, relay/environment sub-errors) with redacted relay/HTTP diagnostics. UI surfaces connection discovery errors via detail where applicable. Server EnvironmentAuth narrows service error unions and enriches auth errors (scopes, session ids, DPoP replay keys, credential kind). Thread outbox delivery treats EnvironmentRpcUnavailableError as retryable.

Reviewed by Cursor Bugbot for commit 761be94. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: aca4a06e-e19d-40b2-acc5-768035ec0922

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/redact-dpop-request-target

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Jun 20, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

Diff is too large for automated approval analysis. A human reviewer should evaluate this PR.

You can customize Macroscope's approvability policy. Learn more.

@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 16:15

Dismissing prior approval to re-evaluate ef9ed1e

@juliusmarminge juliusmarminge changed the title [codex] Share redacted DPoP request targets [codex] Share safe URL diagnostics Jun 20, 2026
@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:XS 0-9 changed lines (additions + deletions). labels Jun 20, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 17:55

Dismissing prior approval to re-evaluate e445dc2

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Jun 20, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 18:10

Dismissing prior approval to re-evaluate 9e3a040

@github-actions github-actions Bot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Jun 20, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 18:23

Dismissing prior approval to re-evaluate c41bc6c

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 18:30

Dismissing prior approval to re-evaluate 6dabb2f

@github-actions github-actions Bot added size:XXL 1,000+ changed lines (additions + deletions). and removed size:XL 500-999 changed lines (additions + deletions). labels Jun 20, 2026
juliusmarminge and others added 25 commits June 20, 2026 19:21
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
@juliusmarminge juliusmarminge force-pushed the codex/redact-dpop-request-target branch from c91fad6 to 9e0c536 Compare June 21, 2026 02:22
juliusmarminge and others added 3 commits June 20, 2026 19:30
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant